<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <meta name="copyright" content="&copy; Copyright Simon Johnston 2009. All rights reserved."/>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

	<title>Running SPARQL Queries</title>

	<script type="text/javascript" src="../advanced/synchWithToc.js"></script>

	<link rel="stylesheet" href="../content/PLUGINS_ROOT/org.eclipse.help.webapp/advanced/breadcrumbs.css" charset="ISO-8859-1" type="text/css"></link>
	<script type="text/javascript" src="../content/PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>

	<link rel="stylesheet" href="../content/PLUGINS_ROOT/PRODUCT_PLUGIN/book.css" type="text/css"></link>
	<script type="text/javascript">if( self == top ){ window.location.replace( "../index.jsp?nav=/0_0");}</script>
  </head>

  <body>

    <h2>Running SPARQL Queries</h2>
	<p>
	  One of the common reasons for using JenaTool is to experiment with and get
	  used to the <a href="http://www.w3.org/TR/rdf-sparql-query/">SPARQL Query 
	  Language for RDF</a>. Having an environment where 
	</p>
	<h3>Creating SPARQL Queries</h3>
	<p>
  	  <img src="images/jt-new.png"/>
  	</p>
  	<p>
	  <img src="images/jt-new-sparql.png"/>
  	</p>
  	<dl>
      <dt>Container</dt><dd>the workspace container in which the resource will be created.</dd>
	  <dt>File name</dt><dd>the name of the workspace resource to create.</dd>
	  <dt>Query Form</dt><dd>the form of the SPARQL query to create, will select a template.</dd>
  	</dl>
  	<pre>
PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#&gt;
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
SELECT ?value
WHERE
{
  ?s &lt;http://example.org/v/some-predicate&gt; ?value
}
  	</pre>
  	<h3>Running Queries</h3>
  	<p>
	  <img src="images/jt-run-query.png"/>
  	</p>
  	<dl>
      <dt>Query Resource</dt><dd>the workspace resource containing the SPARQL query.</dd>
	  <dt>Target Dataset</dt><dd>the dataset to execute the query against.</dd>
	  <dt>Format</dt><dd>the format of the output of DESCRIBE and CONSTRUCT queries.</dd>
	  <dt>Query Context</dt><dd>the model or models over which the query will execute.</dd>
  	</dl>
  	<p>
	  <img src="images/jt-run-query-2.png"/>
  	</p>
	<p>
	  <img src="images/jt-results-view.png"/>
	</p>
	<h4>See Also</h4>
	<ul>
	  <li><a href="results.html">The SPARQL Results View</a></li>
	  <li><a href="preferences.html">JenaTool Preferences</a></li>
	</ul>
  </body>
  
</html>